/****************************************************************************

	COPYRIGHT(C) MAXSI SOFTWARE, JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010

    This file is part of Maxsi Compile.

    Maxsi Compile is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Maxsi Compile is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Maxsi Compile.  If not, see <http://www.gnu.org/licenses/>.

	*/ #include "MaxsiCompileContributors.h" /*

	If you modify this file, please enter your name below and provide contact
	information in MaxsiCompileContributors.h. For more information please see
	MaxsiCompileContributors.h.
	
	Contributors to this file:

	- Jonas 'Sortie' Termansen
	- [your name here]


	MaxsiCompile.exe
	A system to control MaxsiCompile Systems.

	UI.h
	The User Interface for MaxsiCompile

****************************************************************************/

#ifndef UI_H
#define UI_H

class MaxsiCompileUI;
class MaxsiCompileUIConnection;
class MaxsiCompileUIResource;

class MaxsiCompileUIResource
{
public:
	//MaxsiCompileUIResource();
	//~MaxsiCompileUIResource();

public:
	MaxsiCompileUIResource*		Parent;
	MaxsiCompileUIResource*		Child;
	MaxsiCompileUIResource*		Prev;
	MaxsiCompileUIResource*		Next;

public:
	MESTR*		Name;
	HTREEITEM	Handle;
	bool		IsShown;
	int			ListId;
};

class MaxsiCompileUIConnection
{
public:
	MaxsiCompileUI*	Form;
	size_t		Id;
	size_t		Order;
	bool		Hidden;
	bool		HasProgress;

public:
	MaxsiCompileUIConnection();
	~MaxsiCompileUIConnection();

public:
	bool	CreateControls();
	bool	DeleteControls();
	bool	ResizeControls(WORD Width, WORD Height);
	MESTR*	GetConnectionURL();
	MESTR*	GetShortName();
	MESTR*	GetConnectionName();
	MESTR*	GetTabName();
	LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

public:
	bool					AddResource(MESTR* ResourceName);
	MaxsiCompileUIResource*		EnsureResourceExists(MESTR* ResourceName, MaxsiCompileUIResource* Parent);
	bool					BrowseResource(MaxsiCompileUIResource* Resource);
	bool					UnBrowseResource();

public:
	HWND	Tree;
	HWND	URLBox;
	HWND	TabButton;
	HWND	ProgressBar;
	HWND	StatusLabel;
	HWND	CloseTab;
	HWND	Left;
	HWND	Right;
	HWND	Connect;
	MaxsiCompileUIResource	Root;
	MaxsiCompileUIResource*	CurrentlyBrowsed;
};

class MaxsiCompileUI : public MaxsiUI_Form
{
public:
	Declare_Class(MaxsiCompileUI,MaxsiUI_Form);

public:
	virtual bool InitializeForm(ME_Window* Parent);
	virtual bool TerminateForm( void );
	virtual bool RenderForm( HWND hWnd );
	virtual LRESULT APIENTRY WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
	virtual bool NewResolution( WORD Width, WORD Height);

	virtual bool CreateTab();
	virtual	bool DestroyTab(size_t PoorBastard);

public:
	size_t NumConnections;
	size_t NumShownConnections;
	MaxsiCompileUIConnection**	Connections;
	HWND NewTab;

};

#endif